#include<iostream>
#include<algorithm>
using namespace std;
int n,q,ans[200010],pi = 0,we[8010];
struct yuan{
	int b,s;
}ys[8010];
bool cmp(yuan a,yuan b){
	return a.b<b.b&&a.s==b.s||a.s<b.s;
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin >> n >> q;
	for(int i = 0;i < n;i++){
		cin >> ys[i].s;
		ys[i].b = i;
	}
	sort(ys,ys+n,cmp);
	int z,x,v;
	for(int i = 0;i < n;i++){
		we[ys[i].b] = i;
	}
	for(int i = 0;i < q;i++){
		cin >> z >> x;
		x--;
		if(z==1){
			cin >> v;
			if(v>ys[we[x]].s){
				ys[we[x]].s = v;
				int j = we[x];
				while(j < n){
					j++;
					if(ys[j].b>x&&ys[j].s==v||ys[j].s>v){
						break;
					}
					swap(ys[j].b,ys[j-1].b);
					swap(ys[j].s,ys[j-1].s);
					swap(we[ys[j].b],we[ys[j-1].b]);
				}
			}else{
				ys[we[x]].s = v;
				int j = we[x];
				ys[j].s = v;
				while(j >= 0){
					j--;
					if(ys[j].b<x&&ys[j].s==v||ys[j].s<v){
						break;
					}
					swap(ys[j].b,ys[j+1].b);
					swap(ys[j].s,ys[j+1].s);
					swap(we[ys[j].b],we[ys[j+1].b]);
				}
			}
		}else{
			ans[pi] = we[x]+1;
			pi++;
		}
	}
	for(int i = 0;i < pi;i++){
		cout << ans[i] << endl;
	}
	return 0;
}
